package com.ysx.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {


    @PreAuthorize("hasAnyAuthority('add')")
    @RequestMapping("/a1")
    public String hello1() {
        return "add";
    }

    @PreAuthorize("hasAnyAuthority('ROLE_admin')")
    @RequestMapping("/a2")
    public String hello2() {
        return "ROLE_admin";
    }

    @PreAuthorize("hasAnyAuthority('ssdfsdfsdfdss')")
    @RequestMapping("/a3")
    public String hello3() {
        return "ROLE_admin";
    }

}
